#ifndef MACHINEPARAM_H
#define MACHINEPARAM_H

#include "base.h"




class MachineReadParam //读取参数
{
    friend class TcpClient;
public:
    MachineReadParam();
public:
    bool getFatalWarn();//获取急停状态
    bool isLoseNet();//是否掉网
    Direction getDirection();
    unsigned int getLeftSpeed();
    unsigned int getRightSpeed();

    bool getMashineState();//主机启停状态

private:
    bool m_fatalWarn ;
    bool m_bLoseNet;
    Direction m_direction;//方向 0停止 1前进 2前进右转 3右掉头 4后退右转 5后退 6后退左转 7左掉头 8前进左转
    int m_leftSpeed = -1;//左轮速度 取值范围0~3000 单位rpm
    int m_rightSpeed = -1;//右轮速度 取值范围0~3000 单位rpm
    bool m_bStart; //主机启停
};

class MachineWirteParam
{
    friend class TcpClient;
public:
    MachineWirteParam(){};
public:
    void setFatalWarn(bool b);//设置急停
    void setlightWarn(bool b);//设置轻度报警
    void setDirection(Direction  d);
    void setLeftSpeed(unsigned int speed);
    void setRightSpeed(unsigned int speed);
    void setEnable(bool b);

    bool getFatalWarn();

private:
    bool m_fatalWarn = false;
    bool m_lightWarn = false; //轻度报警 1有效
    Direction m_direction;//方向 0停止 1前进 2前进右转 3右掉头 4后退右转 5后退 6后退左转 7左掉头 8前进左转
    unsigned short m_leftSpeed = 0;//左轮速度 取值范围0~3000 单位rpm
    unsigned short m_rightSpeed = 0;//右轮速度 取值范围0~3000 单位rpm
    bool m_enable = false;
};

#endif // MACHINEPARAM_H
